package pers.qianyu.module.core.domain.image.model;

import java.util.HashMap;
import java.util.Map;

/**
 * 字典树节点
 *
 * @author mizzle rain
 * @date 2021-03-17 10:59
 */
public class TrieNode {
    private boolean isEnd;
    private final Map<Character, TrieNode> links;

    public TrieNode() {
        links = new HashMap<>();
    }

    public boolean containsKey(Character ch) {
        return links.containsKey(ch);
    }

    public void put(Character ch, TrieNode node) {
        links.put(ch, node);
    }

    public TrieNode get(Character ch) {
        return links.get(ch);
    }

    public Map<Character, TrieNode> getLinksMap() {
        return links;
    }

    public boolean isEnd() {
        return isEnd;
    }

    public void setEnd(boolean end) {
        isEnd = true;
    }
}
